program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  fin: textfile;
  x0, y0, x1, y1, x2, y2: integer;
  a, b, c: integer;
  d, xd, yd, d1, d2: real;
begin
  assignfile(fin, 'input.txt');
  reset(fin);
  readln(fin, x1, y1);
  readln(fin, x2, y2);
  readln(fin, x0, y0);
  a:=y1-y2;
  b:=x2-x1;
  c:=x1*y2-x2*y1;
  d:=(a*x0+b*y0+c)/sqrt(a*a+b*b);
  xd:=x0-a*d/sqrt(a*a+b*b);
  yd:=y0-b*d/sqrt(a*a+b*b);
  if ((x2-xd)*(x1-xd)<=0) and ((y2-yd)*(y1-yd)<=0) then
    writeln(d:0:3)
  else begin
    d1:=sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
    d2:=sqrt((x2-x0)*(x2-x0)+(y2-y0)*(y2-y0));
    if (d1<=d2) then
      writeln(d1:0:3);
    if (d2<d1) then
      writeln(d2:0:3);
  end;
  readln;
end.
